package com.wxh.bomb.netty.myrpc.service;

import com.wxh.bomb.netty.myrpc.RpcConsumer;
import com.wxh.bomb.netty.myrpc.api.UserService;
import com.wxh.bomb.netty.myrpc.bean.User;

/**
 * @author wxh
 */
public class UserAction {

    public User getUserInfo(int userId) {
        UserService service = (UserService) RpcConsumer.remote(UserService.class);
        return service.getUser(userId);
    }

    public static void main(String[] args) {
        for (int i=0; i< 10 ;i++) {
            final int userId = i;
            new Thread(new Runnable() {
                public void run() {
                    User user = new UserAction().getUserInfo(userId);
                    System.out.println(Thread.currentThread().getName() + user);
                }
            }).start();
        }
    }
}